package com.itboye.mengwu.data.presenter;

import java.util.List;
import java.util.Observer;

import android.util.Log;

import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.core.object.BasePresenter;
import com.itboye.core.object.ResultEntity;
import com.itboye.mengwu.app.ui.main.MainPresenter;
import com.itboye.mengwu.data.interfaces.IGuanzhuMeinterfaces;
import com.itboye.mengwu.data.interfaces.IShopCarNext;
import com.itboye.mengwu.data.model.ShopCarNext;
import com.itboye.mengwu.data.model.ZengBean;
import com.itboye.mengwu.data.repository.ShopCarNextResitory;
import com.itboye.mengwu.data.repository.ZengGuanzhurepository;

public class ZengGuanzhupresenter extends BasePresenter implements
		IGuanzhuMeinterfaces<ZengBean> {

	public static final String Guanzhu_success = MainPresenter.class.getName()
			+ "_Guanzhu_success";
	public static final String GuanzhuFailEvent = MainPresenter.class.getName()
			+ "_Guanzhu_fail";
	

	public static final String Private_success = MainPresenter.class.getName()
			+ "_Guanzhu_success";
	public static final String PrivateFailEvent = MainPresenter.class.getName()
			+ "_Guanzhu_fail";

	public ZengGuanzhupresenter(Observer observer) {
		super(observer);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void add(ZengBean model) {

	}

	@Override
	public void delete(ZengBean model) {

	}

	@Override
	public void update(ZengBean model) {

	}

	@Override
	public void getInfo(ZengBean model) {
		IGuanzhuMeinterfaces<ZengBean> getShopCar = new ZengGuanzhurepository(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						// TODO Auto-generated method stub
						Log.v("MainPresenter", "shopcar success");
						result.setEventTag(Tag_Success);
						result.setEventType(Guanzhu_success);
						ZengGuanzhupresenter.this.setChanged();
						ZengGuanzhupresenter.this.notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						Log.v("MainPresenter", "shopcar fail");
						result.setEventTag(Tag_Error);
						result.setEventType(GuanzhuFailEvent);
						ZengGuanzhupresenter.this.setChanged();
						ZengGuanzhupresenter.this.notifyObservers(result);
					}
				});
		getShopCar.getInfo(model);//

	}

	@Override
	public List<ZengBean> query(ZengBean model) {

		return null;
	}

	@Override
	public void getPrivateMessage(String uid) {
		// TODO Auto-generated method stub
		IGuanzhuMeinterfaces<ZengBean> getShopCar = new ZengGuanzhurepository(
				new ICompleteListener() {

					@Override
					public void success(ResultEntity result) {
						// TODO Auto-generated method stub
						Log.v("MainPresenter", "shopcar success");
						result.setEventTag(Tag_Success);
						result.setEventType(Private_success);
						ZengGuanzhupresenter.this.setChanged();
						ZengGuanzhupresenter.this.notifyObservers(result);
					}

					@Override
					public void failure(ResultEntity result) {
						// TODO Auto-generated method stub
						Log.v("MainPresenter", "shopcar fail");
						result.setEventTag(Tag_Error);
						result.setEventType(PrivateFailEvent);
						ZengGuanzhupresenter.this.setChanged();
						ZengGuanzhupresenter.this.notifyObservers(result);
					}
				});
		getShopCar.getPrivateMessage(uid);
	}

}
